import type { RouteRecordRaw } from 'vue-router';

const routes: RouteRecordRaw[] = [
    {
        path: '/',
        redirect: '/home',
    },
    {
        name: 'login',
        path: '/login',
        component: () => import('@/pages/login/index.vue'),
    },
    {
        name: 'home',
        path: '/home',
        component: () => import('@/pages/home/index.vue'),
        redirect: '/home/resource',
        children: [
            {
                name: 'product',
                path: 'product',
                component: () => import('@/pages/home/product/index.vue'),
                redirect: '/home/product/category',
                meta: {
                    title: '产品配置管理',
                    icon: 'product',
                },
                children: [
                    {
                        name: 'category',
                        path: 'category',
                        component: () => import('@/pages/home/product/category/index.vue'),
                        meta: {
                            title: '品类管理',
                            icon: 'category',
                        },
                    },
                    {
                        name: 'profile',
                        path: 'profile',
                        component: () => import('@/pages/home/product/profile/index.vue'),
                        meta: {
                            title: 'Profile管理',
                            icon: 'profile',
                        },
                    },
                ],
            },
            {
                name: 'resource',
                path: 'resource',
                component: () => import('@/pages/home/resource/index.vue'),
                redirect: '/home/resource/deviceLibrary',
                meta: {
                    title: '开发资料管理',
                    icon: 'resource',
                },
                children: [
                    {
                        name: 'deviceLibrary',
                        path: 'deviceLibrary',
                        component: () => import('@/pages/home/resource/deviceLibrary/index.vue'),
                        meta: {
                            title: '设备库管理',
                            icon: 'device',
                        },
                    },
                    {
                        name: 'sceneLibrary',
                        path: 'sceneLibrary',
                        component: () => import('@/pages/home/resource/sceneLibrary/index.vue'),
                        meta: {
                            title: '场景库管理',
                            icon: 'scene',
                        },
                    },
                ],
            },
            {
                name: 'account',
                path: 'account',
                component: () => import('@/pages/home/account/index.vue'),
                redirect: '/home/account/user',
                meta: {
                    title: '账号管理',
                    icon: 'account',
                },
                children: [
                    {
                        name: 'user',
                        path: 'user',
                        component: () => import('@/pages/home/account/user/index.vue'),
                        meta: {
                            title: '用户管理',
                            icon: 'user',
                        },
                    },
                    {
                        name: 'role',
                        path: 'role',
                        component: () => import('@/pages/home/account/role/index.vue'),
                        meta: {
                            title: '角色管理',
                            icon: 'role',
                        },
                    },
                    {
                        name: 'permission',
                        path: 'permission',
                        component: () => import('@/pages/home/account/permission/index.vue'),
                        meta: {
                            title: '权限管理',
                            icon: 'permission',
                        },
                    },
                    {
                        name: 'enterprise',
                        path: 'enterprise',
                        component: () => import('@/pages/home/views/Developing.vue'),
                        meta: {
                            title: '企业管理',
                            icon: 'enterprise',
                        },
                    },
                ],
            },
        ],
    },
];

export default routes;
